package br.inf.solutions.apresentacoes.ssp.control;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import br.inf.solutions.apresentacoes.ssp.model.Publication;

@Service
@Scope("prototype")
public class PublicationController extends BaseController<Publication> {

	public PublicationController() {
		super(Publication.class);
	}

	public Publication getDefaultPuplication(){
		String sql = "FROM Publication WHERE id = 0";
		data.put("sql", sql);
		
		return (Publication) searchByHQL().getList().get(0);
	}
	
	public Publication getPublicatedPuplication(){
		String sql = "FROM Publication WHERE id = 1";
		data.put("sql", sql);
		
		return (Publication) searchByHQL().getList().get(0);
	}
	
	public Publication getDefaultPuplication(Long id){
		String sql = "FROM Publication WHERE id = " + id;
		data.put("sql", sql);
		
		return (Publication) searchByHQL().getList().get(0);
	}
	
	public Publication getRetificatedPuplication(){
		return (Publication) getDefaultPuplication(2l);
	}
}
